<?php
/**
 * Created by PhpStorm.
 * User: pf
 * Date: 2017/12/15
 * Time: 14:13
 */

namespace App\Repositories;




use App\Http\Controllers\Admin\Business\Repository\Combo;

class CombosRepository
{
    protected $orderRepository;
    public function __construct()
    {
       $this->orderRepository= new OrderRepository();
    }
    public function getList(){
        $combos= Combo::where('status',1)->orderBy('sort','desc')->get();
        foreach ($combos as $k=>$v){
           $combos[$k]['activity_price']= $this->orderRepository->getPrice($v);
        }
        return $combos;
    }
    public function getDetail($combo_id){
        $combo=Combo::where('status',1)->where('id',$combo_id)->firstOrFail();
         $combo->activity_price=$this->orderRepository->getPrice($combo);
        return $combo;
    }
}